import api from '@/api/index.js'
import {refreshTokenPost} from '@/api/refreshToken.js'

const url = '/setting/file/'
// 查询列表
export function ListGet(params) {
  refreshTokenPost(api)
  return api({
    url: url + 'filelist/',
    method: 'get',
    params: params,
  })
}

// 新增
export function ListPost(data) {
  return api({
    url: url + 'filelist/',
    method: 'post',
    data: data,
  })
}


// 查询单个
export function PkGet(pk) {
  return api({
    url: url + 'filepk/' + pk + '/',
    method: 'get',
  })
}
// 修改
export function PkPut(data,pk) {
  return api({
    url: url + 'filepk/' + pk + '/',
    method: 'put',
    data: data,
  })
}

// 删除
export function PkDelete(pk) {
  return api({
    url: url + 'filepk/' + pk + '/',
    method: 'delete',
  })
}



// 文件上传===================================================================
export function uploatFiledPost(data) {
  return api({
    url: url + 'uploadlist/',
    method: 'post',
    data:data,
    headers: {
      'Content-Type': 'multipart/form-data'
    }
  })
}

export function uploatFiledGet(params) {
  return api({
    url: url + 'uploadlist/',
    method: 'get',
     responseType: 'arraybuffer',
    params: params
  })
}